// pages/results/results.js
const app = getApp()
Page({
  data: {
    wrongList: [], // 错误的题数-乱序
    chooseValue: [], // 选择的答案
    remark: ["好极了！你很棒棒哦","哎哟不错哦","别灰心，继续努力哦！"], // 评语
    modalShow: false,
    trueValue: [],
    questionList:[],
    score: null,
    name: 'luxi'
  },
  onLoad: function (options) {
    console.log(options);
    let questionList = JSON.parse(options.questionList);
    let wrongList =JSON.parse(options.wrongList);
    let chooseValue = JSON.parse(options.chooseValue);
    let trueValue = JSON.parse(options.trueValue);
    this.setData({
      wrongList: wrongList,
      chooseValue: chooseValue,
      // 拿到答题数据
      trueValue: trueValue,
      questionList:questionList,
      score: options.score
    })
    console.log(this.data.chooseValue);


  //返回数据
  wx.request({
    url:'http://101.35.134.51:8080/base-in-back-end/app/wechatRanks', 
   
   data:{ 
     "data":{
        "name":this.data.name,
        "score":this.data.score,
    }
  },
     header: {'content-type': 'application/json'},
     method: 'POST',
     success: function (res) {
          console.log("成功");
          console.log(res);  
     }
})
},
  // 查看错题
  toView: function(){
    // 显示弹窗
    this.setData({
      modalShow: true
    })
  },
  // 返回首页
  toIndex: function(){
    wx.switchTab({
      url: '../home/home'
    })
  }
})